#ifndef __IMAGE_H
#define __IMAGE_H

#include "rect.h"
#include "XString.h"
	
class CGImage;

#define BASELINE	64
#define BOTTOM		32
#define HCENTER		1
#define LEFT		4
#define RIGHT		8
#define TOP			16
#define VCENTER		2

class CImage
{
	public:
		CImage();
		~CImage();
	boolean Load( uint8 * pFile,uint32 size );
    boolean Load( const char * path);
    boolean Load( CXString& path);
    boolean Load();
	
		int16 GetWidth() const;
		int16 GetHeight() const;
	
		void Draw( float * vertices );
	    void Draw2D( int16 x, int16 y, _Rect * pClip = NULL, int16 rot = 0, float scalex = 1, float scaley = 1);
		void Draw3D( float x, float y, float z, _Rect * pClip = NULL, int16 rotx = 0,int16 roty = 0,int16 rotz = 0,float scale = 1);
	
		void Blit( _Rect * pClip, int16 x, int16 y, int16 width, int16 height, int16 sourceX, int16 sourceY );
		void BlitTransform( _Rect * pClip, int16 x, int16 y, int16 width, int16 height, int16 sourceX, int16 sourceY, TRANSFORM_TYPE transform );
		void BlitComplexTransform( _Rect * pClip, int16 x, int16 y, int16 width, int16 height, int16 sourceX, int16 sourceY, TRANSFORM_TYPE transform, float angle, float scale = 1 );
		void BlitTransformEx( _Rect * pClip, int16 x, int16 y, int16 width, int16 height, int16 sourceX, int16 sourceY, TRANSFORM_TYPE transform, uint32 alpha);
	
		void Blit( const _Rect * pClip, int16 x, int16 y, int16 width, int16 height, int16 sourceX, int16 sourceY );
		void BlitTransform( const _Rect * pClip, int16 x, int16 y, int16 width, int16 height, int16 sourceX, int16 sourceY, TRANSFORM_TYPE transform );
		void BlitComplexTransform( const _Rect * pClip, int16 x, int16 y, int16 width, int16 height, int16 sourceX, int16 sourceY, TRANSFORM_TYPE transform, float angle, float scale = 1 );
		void BlitTransformEx( const _Rect * pClip, int16 x, int16 y, int16 width, int16 height, int16 sourceX, int16 sourceY, TRANSFORM_TYPE transform, uint32 alpha);

		void Blit( _Rect & pClip, int16 x, int16 y, int16 width, int16 height, int16 sourceX, int16 sourceY );
		void BlitTransform( _Rect & pClip, int16 x, int16 y, int16 width, int16 height, int16 sourceX, int16 sourceY, TRANSFORM_TYPE transform );
		void BlitComplexTransform( _Rect & pClip, int16 x, int16 y, int16 width, int16 height, int16 sourceX, int16 sourceY, TRANSFORM_TYPE transform, float angle, float scale = 1 );
		void BlitTransformEx( _Rect & pClip, int16 x, int16 y, int16 width, int16 height, int16 sourceX, int16 sourceY, TRANSFORM_TYPE transform, uint32 alpha);

	protected:
		void * m_pTexture;
};

#endif // __IMAGE_H